package com.k.activemq;

/**
 * MQ 链接信息
 * @author kkk
 */
public class MqConnectionEntity {
    private String clientID;
    private String url;
    private String username;
    private String password;
    private String destination;
    /**
     * true: topic  false: queue
     */
    private Boolean pubSubDomain;
    private String message;

    /**
     * true:use byte Message
     */
    private Boolean byteMessage;

    public MqConnectionEntity(String clientID,String url, String username, String password, String destination,Boolean pubSubDomain,String msg,Boolean byteMsg) {
        this.url = url;
        this.username = username;
        this.password = password;
        this.destination = destination;
        this.pubSubDomain = pubSubDomain;
        this.message = msg;
        this.byteMessage = byteMsg;
    }

    public String getClientID() {
        return clientID;
    }

    public void setClientID(String clientID) {
        this.clientID = clientID;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getDestination() {
        return destination;
    }

    public void setDestination(String destination) {
        this.destination = destination;
    }

    public Boolean getPubSubDomain() {
        return pubSubDomain;
    }

    public void setPubSubDomain(Boolean pubSubDomain) {
        this.pubSubDomain = pubSubDomain;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Boolean getByteMessage() {
        return byteMessage;
    }

    public void setByteMessage(Boolean byteMessage) {
        this.byteMessage = byteMessage;
    }

    @Override
    public String toString() {
        return "MqConnectionEntity{" +
                "url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", destination='" + destination + '\'' +
                ", pubSubDomain=" + pubSubDomain +
                ", message='" + message + '\'' +
                ", byteMessage=" + byteMessage +
                '}';
    }

    public static MqConnectionEntityBuilder newBuilder(){
        return new MqConnectionEntityBuilder();
    }

    public static class MqConnectionEntityBuilder{
        private String clientID;
        private String username;
        private String password;
        private String url;
        private String destination;
        private Boolean pubSubDomain;
        private String message;
        private Boolean byteMessage;

        public MqConnectionEntityBuilder setClientID(String clientID) {
            this.clientID = clientID;
            return this;
        }
        public MqConnectionEntityBuilder setUsername(String username) {
            this.username = username;
            return this;
        }

        public MqConnectionEntityBuilder setPassword(String password) {
            this.password = password;
            return this;
        }

        public MqConnectionEntityBuilder setUrl(String url) {
            this.url = url;
            return this;
        }

        public MqConnectionEntityBuilder setDestination(String destination) {
            this.destination = destination;
            return this;
        }

        /**
         * if topic set true if queue set false
         * @param pubSubDomain pub-sub-model
         * @return
         */
        public MqConnectionEntityBuilder setPubSubDomain(Boolean pubSubDomain) {
            this.pubSubDomain = pubSubDomain;
            return this;
        }

        public MqConnectionEntityBuilder setMessage(String message) {
            this.message = message;
            return this;
        }

        public MqConnectionEntityBuilder setByteMessage(Boolean byteMessage) {
            this.byteMessage = byteMessage;
            return this;
        }

        public  MqConnectionEntity build() {
            return new MqConnectionEntity(this.clientID,this.url,this.username, this.password, this.destination,this.pubSubDomain,this.message,this.byteMessage);
        }
    }
}
